﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AutoCode.SqlServer
{
    /// <summary>
    /// 全局常量类
    /// </summary>
    public class AppConst
    {

        /// <summary>
        /// if关键字的字典表，key=标签匹配关键字；value=string[3] index_0=列关键字，匹配是否存在、index_1=存在的输出代码、index_2=2不存在的输出代码
        /// </summary>
        public static Dictionary<string, string[]> CONST_IFKEYS = new Dictionary<string, string[]> {
           { "$IF_REQNAME$",  new string[]{"name", ",Request[\"name\"]", ""} },
           { "$IF_D.STATE$", new string[]{"state", "d.id!=-1", "d.id!=-1"} },
           { "$IF_PARAMISNAME$", new string[]{"name", " string name, ", ""} },
           { "$IF_FINDBYNAME$", new string[]{"name", "\r\nif (!string.IsNullOrEmpty(name))\r\n{ // 名称模糊查询\r\ndata = data.Where(d => d.name.Contains(name));\r\n}", ""}}
        };

        /// <summary>
        /// 数据库类型和C#类型对照表
        /// </summary>
        public static Dictionary<string, string> CONST_DBTYPES = new Dictionary<string, string> {
            { "int", "int" },{ "bigint", "long" },{ "smallint", "short" },{ "tinyint", "short" },{ "varchar", "string" },
            { "text", "string" },{ "char", "string" },{ "nchar", "string" },{ "ntext", "string" },{ "nvarchar", "string" },
            { "bit", "bool" },{ "datetime", "DateTime" },{ "decimal", "Decimal" },{ "float", "double" },{ "double", "double"}
        };



    }
}
